<?php

class alipays
{

    function jszf($uid,$id,$type,$lx=''){  	
    	require_once(SYS_DIR.'base'.DS.'zfb'.DS.'alipay.config.php');
    	
    	require_once(SYS_DIR.'base'.DS.'zfb'.DS.'lib/alipay_submit.class.php');
    	if($type == 1){  //套餐充值
    		$dt = C_base::M('admin.recruit')->dingdan_s($uid,array('uid'=>$uid,'id'=>$id));
    		$mo = C_base::M('admin.xitonggl')->tc_s(array('id'=>$dt['type']));
    		if($lx == 1){
    			$zz = 'firm';
    		}else{
    			$zz = 'vip';
    		}
    		/* if($dt['type'] == 1){
    			$money = '0.01';
    		}elseif($dt['type'] == 2){
    			$money = '0.02';
    		}if($dt['type'] == 3){
    			$money = '0.03';
    		} */
    		if($uid == 4){
    			$mo['money'] = 0.01;
    		}
    	}
    	
    	$parameter = array(
    			"service" => "create_direct_pay_by_user",
    			"partner" => trim($alipay_config['partner']),
    			"seller_email" => trim($alipay_config['seller_email']),
    			"payment_type"	=> 1, //支付类型 不能修改
    			"notify_url"	=> 'http://www.sky9001.com/notify_url.php', //服务器异步通知页面路径
    			"return_url"	=> 'http://www.sky9001.com/?act=job', //页面跳转同步通知页面路径
    			"out_trade_no"	=> $dt['id'].'-'.$uid.'-'.$zz, //商户订单号
    			"subject"	=> $dt['name'], //订单名称
    			"total_fee"	=> $mo['money'], //付款金额
    			"body"	=> $dt['content'], //订单描述
    			"_input_charset"	=> trim(strtolower($alipay_config['input_charset'])) //字符编码格式 目前支持 gbk 或 utf-8
    	);
    	
    	//建立请求
    	$alipaySubmit = new AlipaySubmit($alipay_config);
    	$html_text = $alipaySubmit->buildRequestForm($parameter,"get", "下一步",$type);
    	return  $html_text;
    }
}